package com.ikun.pojo.dto;

import com.ikun.core.pojo.dto.group.CreateGroup;
import com.ikun.core.pojo.dto.group.UpdateGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

@Data
@Schema(name = "UserDTO")
public class UserDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @Null(groups = CreateGroup.class)
    @NotNull(groups = UpdateGroup.class)
    private Long id;

    @NotBlank(message = "用户名不能为空")
    private String username;

    @Min(value = 1, message = "年龄必须大于等于1")
    @Max(value = 150, message = "年龄必须小于等于150")
    @NotNull(message = "年龄不能为空")
    private Integer age;

//    @Email
//    @NotBlank  // 没有写 groups → 属于 Default.class 组
//    private String email;
//
//    @NotBlank(groups = QueryGroup.class)
//    private String keyword;
}
